#fileSelection.py - Used to find and list files of a certain type
#in a given directory.

import os

class fileSelection(object):
    """Default directory is current."""

    def __init__(self, directory=os.curdir):
        """Sets directory."""
        self.directoryFiles=os.listdir(directory)

    def createListByType(self, fileType):
        """Returns an array of fileType's in directory.

        fileType is a string
        """
        self.files=[]
        for fileName in self.directoryFiles:
            basename, extension = os.path.splitext(fileName)
            if extension == fileType:
                self.files.append(basename + extension)
        return self.files
